package org.neuedu.chapter05_0618;

public class MethodDemo10 {
    public static void main(String[] args) {
        int[] arr = {32, 5, 7, 43, 2, 54, 76, 8, 9};
        int num = test(arr);
        System.out.println(num);

        int num2 = test(null);
        System.out.println(num2);
    }

    public static int test(int[] arr) {
        if (arr != null) {
            int max = arr[0];
            for (int num : arr) {
                if (num > max) {
                    max = num;
                }
            }
            return max;
        }
        return -9999;
    }
}
